package lab2.text22;

/**
 * Created by Administrator on 2017/10/30.
 */
public class Text {
    public static void main(String[] args) {

        String str = "XYZ987——";
        System.out.println("原字符串:" + str);
        StringBuffer newstr = new StringBuffer();
        char[] c = new char[str.length()];
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch >= 'A' && ch <= 'Z') {
                newstr.append( (char) (ch + 32));
            } else if (ch >= 'a' && ch <= 'z') {
                newstr.append(ch);

            } else if (ch >= '0' && ch <= '9') {

                newstr.append(0);

            } else {
            }
            newstr.append("#");
        }
        System.out.println( "转化后："+newstr);
    }
}
